home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / mail / YAMscripts.lha / YAMmail.rexx < prev    next >
OS/2 REXX Batch file  |  1996-11-20  |  2KB  |  57 lines

  1. /* YAMmailAWeb.rexx 1.1 by knikulai@utu.fi
  2.    
  3.   Copy the script into the same directory where AWeb is and select settings
  4.   page 'Network 3: General settings' and enter the following values
  5.   'mailto: Command'    sys:rexx/rx 
  6.   'mailto: Arguments'  YAMmailAWeb.rexx %s   <-- this only works for the demo version
  7.                            check your manual for version 2
  8. */
  9. subject='Mail from your web page'
  10.  
  11. Options Results
  12. parse arg email /* an adress could become useful later...*/
  13.  
  14. ports=show('P')                        /* What ports are there? */
  15. parse var ports dummy 'AWEB.' portnr . /* Get a valid AWeb port */
  16. address value 'AWEB.' || portnr 
  17. 'get activeport'                       /* Ask AWeb which window started the script */
  18. browser=result                         /* Remember the windows port */
  19.  
  20. if show('P','YAM')=0 then do           /* YAM is not running yet, so let's start it */
  21.   address command 'run <>nil: yam:yam nocheck'
  22.   i=0
  23.   do until show('P','YAM')>0 | i=3     /* Let's not wait more than 30 seconds */
  24.     address command 'sys:rexxc/WaitForPort YAM'
  25.     i=i+1
  26.   end /* do */
  27.   if show('P','YAM')=0 then exit
  28. end
  29.  
  30. /* Now we know YAM is up and running */
  31.  
  32. address 'YAM' 'Request "Do you want to include current page?" "Yes|No|Cancel"'
  33. choice=result
  34.  
  35. /* Now we know what the user wants to do.. */
  36.  
  37. if choice='0' then exit         /* User selected Cancel */
  38. njaah=pos('?SUBJECT=',upper(email))
  39. if njaah>0 then do
  40.     subject=right(email,length(email)-njaah-8)
  41.     email=left(email,njaah-1)
  42.     end
  43. address 'YAM'              /* The following commands are sent to YAM */
  44. 'Show'                /* Uniconify */
  45. 'MailWrite'                /* Press 'Write'-button */
  46. 'WriteMailTo "'||email||'"'     /* Set address */
  47. 'WriteSubject "'||subject||'"'     /* Set subject */
  48.  
  49. if choice='1' then do /* Include current page */
  50.   address value browser                 /* Send next line to current AWeb window */
  51.   'saveas t:foo'                        /* Ask AWeb to save current page to a file */
  52.   address 'YAM' 'WriteLetter "t:foo"'   /* Insert file into letter */
  53.   address command 'delete <>nil: t:foo' /* delete file */
  54. end
  55.  
  56. exit
  57.